package code.main.view.hall
{
	import code.common.assets.AssetsClassName;
	import code.main.modle.lang.Language;
	
	import com.yy.manager.ResourceManager;
	import com.yy.tools.string.StringUtil;
	import com.yy.ui.controls.Button;
	
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.display.SimpleButton;
	import flash.display.Sprite;
	import flash.text.TextField;
	
	import org.casalib.time.Inactivity;
	
	public class TopInfoView extends Sprite
	{
		/**
		 *丁部信息条 
		 * 
		 */
		public var view:Object;//顶部资源条
		public var moneyView:MovieClip;//游戏币
		public var platformView:MovieClip;//中介币
		public var rechargeBtn:SimpleButton;//充值
		public var prizeView:MovieClip;//成就
		public var levelBar:MovieClip;//等级
		public var messageView:MovieClip;//消息
		public var reportBugBtn:SimpleButton;//反馈按钮
		public var setting:SimpleButton;//设置
		public var fullScreenBtn:MovieClip;//全屏按钮
		public var netState:MovieClip;//反馈按钮
		public function TopInfoView()
		{
			super();
			init();
		}
		private function init():void {
			var dobj:DisplayObject;
			view = ResourceManager.getSpriteByName(AssetsClassName.TOP_INFO_UI);
			dobj = addChild(DisplayObject(view));
			moneyView = view.moneyView;
			platformView = view.platformView;
			rechargeBtn = view.rechargeBtn;
			prizeView = view.prizeView;
			prizeView.buttonMode = true;
			prizeView.mouseChildren = false;
			levelBar = view.levelBar;
			levelBar.mouseChildren = false;
			messageView = view.messageView;
			messageView.alarmClip.gotoAndStop(1);
			reportBugBtn = view.reportBugBtn;
			setting = view.setting;
			fullScreenBtn = view.fullScreenBtn;
			fullScreenBtn.gotoAndStop(1);
			fullScreenBtn.buttonMode = true;
			netState = view.netState;
			networkState = 4;
		}
		
		/**
		 *设置网络状态 
		 * @param state
		 * 
		 */
		public function set networkState(state:int):void {
			var i:int;
			var len:int = state;
			for(i=0; i<len; i++) {
				netState["bar" + (i+1)].gotoAndStop(2);
			}
			if(state < 4) {
				for(i; i<len; i++) {
					netState["bar" + (i+1)].gotoAndStop(1);
				}
			}
		}
		
		/**
		 *显示金币 
		 * @param value
		 * 
		 */
		public function set gameMoney(value:Number):void {
			moneyView.label.text = StringUtil.getDollarFormat(value);
		}
		
		/**
		 *设置平台币 
		 * @param value
		 * 
		 */
		public function set platfromMoney(value:Number):void {
			platformView.label.text = String(value);
		}
		
		/**
		 *设置成就数量 
		 * @param getPrizeNumb
		 * @param totalPrizeNumb
		 * 
		 */
		public function setPrize(getPrizeNumb:int, totalPrizeNumb:int):void {
			prizeView.label.text = getPrizeNumb + "/" + totalPrizeNumb;
		}
		
		/**
		 *等级称号 
		 * @param title
		 * 
		 */
		public function set levelTitle(title:String):void {
			levelBar.levelTitle.text = title;
		}
		/**
		 *等级 
		 * @param value
		 * 
		 */
		public function set level(value:int):void {
			levelBar.userLevel.text = String(value);
		}
		/**
		 *经验 
		 * @param curentExp
		 * @param needExp
		 * 
		 */
		public function setExperience(curentExp:int, needExp:int):void {
			levelBar.experience.text = curentExp + "/" + needExp;
			levelBar.scaleBar.width = int((levelBar.track.width)*(curentExp/needExp)); 
		}
	}
}